

package com.zjdt.epserver.db.service4mysql;

import com.zjdt.epserver.db.dao.TruckDao;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;

/**
 *
 * @author dusin
 */
public class TruckServiceImpl {
    static Logger logger = Logger.getLogger(TruckServiceImpl.class);
    TruckDao truckDao;

    public TruckServiceImpl(TruckDao truckDao) {
        this.truckDao = truckDao;
    }  
    
     
    public List<Map<String,Object>> findAll(int driverId){
        return truckDao.findAllByDriverId(driverId);
    } 
     
     public boolean create(int driverId,String plateNumber,String type,double load,
             String brand,String color,String note,String photo,String licensePhoto){
        return truckDao.doCreate(new Object[]{driverId,"",plateNumber,
            type,load,brand,color,note,photo,licensePhoto}); //
    }
    
    public boolean update(int id,String plateNumber,String type,double load,
             String brand,String color,String note,String photo,String licensePhoto){
        return truckDao.doUpdateById(new Object[]{"",plateNumber,
            type,load,brand,color,note,photo,licensePhoto,id});
    }    
    
    //
    public boolean updatePhotoById(int id,String photo){
        return truckDao.doUpdatePhotoById(new Object[]{photo,id});
    }
    
    //
    public boolean updatelicensePhotoById(int id,String licensePhoto){
        return truckDao.doUpdateLicensePhotoById(new Object[]{licensePhoto,id});
    }
    
    public boolean remove(int id){
        return truckDao.doDeleteById(id);
    }    
}
